import request from '../utils/request'
import {reqwest_get , reqwest_url} from '../utils/Reqwest.js'


let formData = new FormData();
var searchParams = new URLSearchParams()
let data ;

export async function fetch(values) {
  if (!values.payload.limit) {
    values.payload.limit = 10;
  }
  const q = values.payload.q && values.payload.q !== '' ? `&q=${values.payload.q}` : '';
	return request(`/api/orders?page=${values.payload.current}&pre=${values.payload.limit}&limit=${values.payload.limit}${values.payload.tab}${q}`, {
	    method: 'get',
  });
}


export async function listSave(values) {
	formData.append('id', 1)
	formData.append('estimated_total' ,123)
	searchParams.set('id', 1)
	searchParams.set('estimated_total' ,JSON.stringify({aa:1}))

	// ${values.payload.body}
	return request(`/api/orders/update_estimated_total`,{
		method: 'post',
		body: JSON.stringify(values.payload.body)
		// body: JSON.stringify({
		// 	id: 25,
		// 	estimated_total: 123,
		// 	arr: {
		// 		a: 123
		// 	}
		// })
	})
}

export async function test(values){
	reqwest_url('/api/orders/update_estimated_total','post',{
		aa:{a:1}
	},(data)=>{
		data = data
	})
	return data
}
